{* $Id$ *}
{include_core file="admin/lib/header.html" title="用户展示"}
<div class="page-header border-bottom clearfix">
  <h2 class="left">用户管理<span>添加{$role}</span></h2>
  <a href="{AnUrl('user/admin')}" class="btn btn-default btn-sm right">&lt;&nbsp;返回用户列表</a>
</div>
<!--start:用户新增-->
<div class="add-form">
  <form class="js_creatForm" action="{AnUrl('user/admin/director/save')}" method="post" enctype="multipart/form-data">
    <table class="table" cellpadding="0" cellspacing="0">
      <input type="hidden" name="info[role_id]" value="{$role_id}" />
       <input type="hidden" name="id" value="{$info.id}" />
      <tr>
        <th><label for="" class="add-f-label">选择事业部：</label></th>
        <td>
          <select name="info[division_id]"  >
          <option value="0">请选择事业部</option>
          {html_options options=$division_arr selected=$info.division_id}
          </select>
        </td>
      </tr>
      {include file="admin/add_common_field.html"}
    </table>
  </form>
</div>
<!--end:用户新增-->
<script>
$(function(){
 // 初始化用户编辑页面

  // 提交验证
  $('.js_submit').click(function(e){
      
    e.preventDefault();
//    var userName      = $.trim($('.js_userName').val());
    var password      = $.trim($('input[name="info[password]"]').val());
//    var email         = $.trim($('.js_email').val());
    var mobile        = $.trim($('.js_mobile').val());
//    var nickname      = $.trim($('input[name="info[nickname]"]'));
    // var realname      = $.trim($('input[name="info[realname]"]').val());
    
    // 真实姓名不能为空
    if ($('input[name="info[realname]"]').val() == '') {
        showMsg('真实姓名不能为空!');
        return false;
    }
    
    // 真实姓名不能为空
    if ($('input[name="info[nickname]"]').val() == '') {
        showMsg('昵称不能为空!');
        return false;
    }
    
    if(password && is_pwd_null(password)) {
      showMsg('密码内不能存在空字符!');
      return;
    }
    if (password && getStringLen(password) < 6) {
      showMsg('密码不能少于6个字符!');
      return;
    }
//
//    if (email) {
//      if (!checkStr(email, 'mail')) {
//        showMsg('邮箱格式不正确!');
//        return;
//      }
//    }
    if(mobile) {
      if(!checkStr(mobile, 'mobile')) {
        showMsg('手机号码格式不正确!');
        return;
      }
    }
    
    $('.js_creatForm').submit();
  });
/*   
//上传图片预览
  $(".js_upFile").each(function(i){
    $(this).change(function(e){
      handleFileSelect($(this), 270);
    });
  }); */
  
  
  
});

</script>
{include_core file="admin/lib/footer.html"}